home *** CD-ROM | disk | FTP | other *** search
- Path: wilde.oit.umass.edu!not-for-mail
- From: ksexton@wilde.oit.umass.edu (Kevin M Sexton)
- Newsgroups: comp.lang.c
- Subject: Problem with a for loop
- Date: 2 Mar 1996 03:41:09 GMT
- Organization: University of Massachusetts, Amherst
- Message-ID: <4h8g0l$1ot@nic.umass.edu>
- NNTP-Posting-Host: oitunix.oit.umass.edu
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Hi.
- I was doing a project for one of my classes and I came across a rather
- odd bug in part of the code. I initially had the following:
- for ( i = 0; WL[i] != NULL, i <= 10; i++ )
- {
- AAL[i] = new char[strlen(WL[i])+1);
- strcpy(AAL[i], WL[i]);
- }
-
- I realize that new belongs to C++, but that's not where the confusion
- lies. WL is an array of pointers to strings. WL[0]="./my_macro" and
- WL[1]=NULL. However, the for loop insists on continuing the loop even
- when i=1 and WL[i]=NULL. Am I missing something? I can't see what is
- wrong logically. Any assistance would be much appreciated. Thanx in
- advance.
-
- Kevin
- ksexton@wilde.oit.umass.edu
-
-